{% extends 'user/master.html' %}
{% block CSS %}
<style>
    a:active {
        color: #778087;
        text-decoration: none;
        word-break: break-all;
    }
    .widgets {
        display: flex;
        flex-flow: row wrap;
        padding: 5px;
    }
</style>
{% endblock %}
{% block main %}
<div class="box">
    <div class="cell">
        <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tbody>
                <tr>
                    <td width="73" valign="top" align="center">
                        <img src="{{ user_obj.avatar }}" class="rounded avatar" border="0" align="default">
                        <div class="sep10"></div>
                        {% if online_status %}
                            <span class="badge badge-pill badge-success"> &nbsp; ONLINE &nbsp; </span>
                        {% else %}
                            <span class="badge badge-pill badge-light"> &nbsp; OFFLINE &nbsp; </span>
                        {% endif %}
                    </td>
                    <td width="10"></td>
                    <td width="auto" valign="top" align="left">
                        {% if request.session.user_info %}
                            {% if request.session.user_info.username != user_obj.username %}
                                <div class="fr">
                                    {% if is_following.0 == 1 %}
                                        <input type="button" value="取消特别关注"
                                               onclick="if (confirm('确认要取消对 {{ user_obj.username }}的关注 ？')) { location.href = '{% url 'following' user_obj.username %}'; }"
                                               class="btn btn-sm btn-secondary">
                                    {% else %}
                                        <input type="button" value="加入特别关注"
                                               onclick="if (confirm('确认要开始关注 {{ user_obj.username }}？')) { location.href = '{% url 'following' user_obj.username %}'; }"
                                               class="btn btn-sm btn-warning">
                                    {% endif %}
                                    <div class="sep10"></div>
                                    {% if is_block.0 == 1 %}
                                        <input type="button" value="Unblock"
                                               onclick="if (confirm('确认要解除对 {{ user_obj.username }}的屏蔽 ？')) { location.href = '{% url 'block' user_obj.username %}'; }"
                                               class="btn btn-sm btn-dark">
                                    {% else %}
                                        <input type="button" value="Block"
                                               onclick="if (confirm('确认要屏蔽 {{ user_obj.username }}？')) { location.href = '{% url 'block' user_obj.username %}'; }"
                                               class="btn btn-sm btn-dark">
                                    {% endif %}
                                </div>
                            {% endif %}
                        {% endif %}
                        <h1 style="margin-bottom: 5px;">{{ user_obj.username }}</h1>
                        <span class="bigger"></span>
                        <div class="sep10"></div>
                        <span class="gray"><li class="fa fa-time"></li> &nbsp; V2EX 第 {{ user_obj.id }} 号会员，加入于 {{ user_obj.date_joined }}，今日活跃度排名 <a href="/top/dau">407</a></span>
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="sep5"></div>
    </div>
    <div class="widgets">
        {% if user_obj.location %}
            <a href="http://www.google.com/maps?q={{ user_obj.location }}" class="social_label" target="_blank" rel="nofollow">
            <span class="fa fa-map-pin"> &nbsp; &nbsp;
            </span>{{ user_obj.location }}</a>
        {% else %}
            <a href="#" class="social_label" target="_blank" rel="nofollow">
            <span class="fa fa-map-pin"> &nbsp; &nbsp;
            </span>火星</a>
        {% endif %}
    </div>
</div>
<div class="sep20"></div>
<div class="box">
    {% for obj in topic_obj %}
        <div class="cell item">
            <div class="row topic">
                <div class="col-8">
                    <div class="row topic-title">
                        <div><a href="{% url 'topic' obj.topic_sn %}">{{ obj.title|safe }}</a></div>
                    </div>
                    <div class="row topic-info">
                        <a href="{% url 'node' obj.category.code %}" class="badge badge-light">{{ obj.category.name }}</a>
                        <a href="{% url 'member' user_obj.username %}">{{ user_obj.username }}</a> •
                        {% if obj.last_comment_user %}
                            &nbsp;•&nbsp; {{ obj.last_comment_time }} &nbsp;•&nbsp; 最后回复来自
                            <strong>
                                <a href="{% url 'member' obj.last_comment_user %}">{{ obj.last_comment_user }}</a>
                            </strong>
                        {% endif %}
                    </div>
                </div>
                <div class="col-1  offset-2">
                    <a href="{% url 'topic' obj.topic_sn %}" class="badge badge-pill badge-secondary">&nbsp;{{ obj.comment_num }}&nbsp;</a>
                </div>
            </div>
        </div>
    {% endfor %}
</div>
{% endblock %}